package com.wzq.app.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.cb.ratingbar.CBRatingBar;
import com.wzq.app.R;
import com.wzq.app.model.RateModel;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ProjectName: wzq
 * @Package: com.wzq.app.adapter
 * @ClassName: RatingAdapter
 * @Description: java类作用描述
 * @Author: Tao.xiaolong
 * @CreateDate: 2021/2/24 15:25
 * @UpdateUser: 更新者：
 * @UpdateDate: 2021/2/24 15:25
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class RatingAdapter extends BaseAdapter {

    LayoutInflater inflater;
    List<RateModel> rateModels;

    Map<String, String> map = new HashMap<>();

    public RatingAdapter(Context context, List<RateModel> list) {
        this.inflater = LayoutInflater.from(context);
        this.rateModels = list;
    }

    @Override
    public int getCount() {
        return rateModels.size();
    }

    @Override
    public RateModel getItem(int position) {
        return rateModels.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = inflater.inflate(R.layout.rating_item, parent, false);
        TextView title = view.findViewById(R.id.rating1_title);
        TextView textView = view.findViewById(R.id.rating1_text);
        CBRatingBar cbRatingBar = view.findViewById(R.id.rating1);
        title.setText((position+1)+"."+rateModels.get(position).getEvaName());
        return view;
    }
}
